﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using DbLibrary.DataBase;

namespace DbLibrary.Helpers
{
    public class ValidateHelper
    {
        public static bool ValidateUser(Models.User user)
        {
            if (user.UserName.Length > 0)
            {
                try
                {
                    var userRep = new UserRepository();
                    var usr = userRep.GetAll().Single(_ => _.UserName == user.UserName && _.Password == user.Password);
                    //
                    return usr != null;
                }
                catch(Exception ex)
                {
                    return false;
                }
            }
            return false;
        }
    }
}